from django.db import models

# Create your models here.
class Bugs(models.Model):
    id = models.AutoField('ID', primary_key=True)
    module = models.CharField('模块', max_length=100)
    func = models.CharField('功能', max_length=100)
    remark = models.CharField('描述', max_length=500)
    createTime = models.DateTimeField(auto_now_add=True)
    createUser_choices = {
        (1, "任光辉"),
        (2, "灵芝"),
        (3, "孟林杰"),
        (4, "任总"),
    }
    createUser = models.IntegerField('创建用户', choices=createUser_choices, default=3)
    solveUser = models.CharField('解决用户', max_length=100, default='', blank=True)
    solveTime = models.DateTimeField('解决时间', blank=True)
    solution = models.CharField('解决方案', max_length=500, default='', blank=True)
    type_choices = (
        ("1", "未解决"),
        ("2", "解决未部署"),
        ("3", "解决已部署"),
        ("4", "无法重现"),
        ("5", "验证未通过"),
        ("6", "验证通过"),
        ("7", "设计如此"),
        ("8", "无法实现"),
        ("9", "重复BUG"),
    )
    type = models.CharField('订单状态',max_length=1, choices=type_choices, default=1)

    class Meta:
        ordering = ('-createTime',)
        db_table = "bugs"

class Dictionary(models.Model):
    id = models.AutoField('ID', primary_key=True)
    code = models.CharField('编码', max_length=20)
    name = models.CharField('中文', max_length=50)
    pcode = models.CharField('父级编码', max_length=20)
    spell = models.CharField('拼音', max_length=100, default='', blank=True)
    order = models.IntegerField('排序')
    remark = models.CharField('备注', max_length=500, default='', blank=True)

    class Meta:
        db_table = "dictionary"
